#include<bits/stdc++.h>
using namespace std;
const int N = 500001;

int n,m;
int tree[N];

inline int lowbit(int x){
    return x & (-x);
}
inline void update(int idx,int num){
    for(int i=idx;i<=n;i+=lowbit(i)){
        tree[i] += num;
    }
}
inline int getSum(int idx){
    int sum = 0;
    for(int i=idx;i>0;i-=lowbit(i)){
        sum += tree[i];
    }
    return sum;
}

int main(){
    scanf("%d%d",&n,&m);
    int num;
    for(int i=1;i<=n;i++){
        scanf("%d",&num);
        update(i,num);
    }
    int op,x,k,y;
    for(int i=1;i<=m;i++){
        scanf("%d%d%d",&op,&x,&y);
        if(op==1){
            update(x,y);
        }else{
            printf("%d\n",getSum(y)-getSum(x-1));
        }
    }
}